package edu.gdkm.extendsdemo;

public class Test2 {
    public static void main(String[] args) {
        Teacher teacher = new Teacher();
        teacher.setId("9527");
        teacher.setName("刘溜溜");
        teacher.setCourse("Java");

        Student student =new Student();
        student.setId("8869");
        student.setName("伍佰");
        student.setMajor("软件");

        Assistant assistant = new Assistant();
        assistant.setId("8888");
        assistant.setName("张三");
        assistant.setSex("男");

        IdentityConfirm identityConfirm =new IdentityConfirm();
        identityConfirm.confirm(teacher);
        identityConfirm.confirm(student);
        identityConfirm.confirm(assistant);

        //向上转型
        Person person = new Staff();
        person.introduction();

        //对于向上转型的对象，不能调用子类独有的方法和属性，比如person.manager();

        //向下转型（强制转换）简单数据类型强制转换可能会损失精度，向下转型则不允许非本类型的对象进行强制转换
//        double a=5.01;
//        int b = (int)a;
        Staff staff =(Staff) person;
        staff.manager();


    }
}
